use crate::model::db;
use crate::model::request::{User, UserEdit, UserSearch};
use crate::model::response::{UserInfoRes, UserList, UserName};
use sqlx::{self};

// 根据 username 查询 user
pub async fn query_admin_username(username: &str) -> Result<UserName, sqlx::Error> {
    let pool = db::get_pool().unwrap();
    let user: UserName = sqlx::query_as("SELECT username FROM tb_im_users WHERE username = ?")
        .bind(username)
        .fetch_one(pool)
        .await?;
    Ok(user)
}
